//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package com.goldhuman.Common;

import java.util.Observable;
import java.util.Timer;
import java.util.TimerTask;

public class TimerObserver extends Observable {
    private static TimerObserver instance = new TimerObserver();
    private static long now = System.currentTimeMillis();
    private Timer timer = new Timer("jio--TimerObserver");

    public static TimerObserver GetInstance() {
        return instance;
    }

    public TimerObserver() {
        this.timer.schedule(new TimerTask() {
            public void run() {
                TimerObserver.now = this.scheduledExecutionTime();
                TimerObserver.instance.setChanged();
                TimerObserver.instance.notifyObservers();
            }
        }, 0L, 1000L);
    }

    public void StopTimer() {
        this.timer.cancel();
    }

    public static class WatchDog {
        private long t;

        public WatchDog() {
            this.t = TimerObserver.now;
        }

        public long GetTime() {
            return TimerObserver.now;
        }

        public long Elapse() {
            return TimerObserver.now - this.t;
        }

        public void Reset() {
            this.t = TimerObserver.now;
        }
    }
}
